package com.example;

/**
 * Created by zengliang on 17/6/17.
 */

public class MatchTest {
    public static void main(String[] args) throws Exception {


        System.out.println(getPreferenceVale(""));
        System.out.println(getPreferenceVale(null));
        System.out.println(getPreferenceVale("80"));
        System.out.println(getPreferenceVale("1000,4000"));
        System.out.println(getPreferenceVale("0"));

    }


    /**
     * 优惠信息根据reduceRule 获取preferenceValue
     *
     * @param reduceRule
     * @return
     */
    private static int getPreferenceVale(String reduceRule) {
        if (reduceRule == null || "".equals(reduceRule)) {
            return 0;
        }
        int preferenceValue = 0;
        try {
            preferenceValue = Integer.parseInt(reduceRule);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return preferenceValue;
    }
}
